package com.adee.java.collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * 实现了Iterable接口的类都可以使用增强for循环
 */
public class Test001_Iterable {
    public static void main(String[] args) {
        MyArrayList<Object> list = new MyArrayList<>();
        for (Object t : list) {
            System.out.println(t);
        }
        List<Object> list2 = Collections.synchronizedList(new ArrayList<>());
    }

    static class MyArrayList<T> implements Iterable<T> {

        @Override
        public Iterator<T> iterator() {
            return null;
        }
    }
}


